Update app.py
Browse files
app.py
CHANGED
@@ -12,7 +12,7 @@ def generate_code(prompt, max_length):
|
|
12 |
inputs = tokenizer(prompt, return_tensors="pt")
|
13 |
streamer = TextIteratorStreamer(tokenizer)
|
14 |
|
15 |
-
generation_kwargs = dict(inputs, streamer=streamer,
|
16 |
thread = Thread(target=model.generate, kwargs=generation_kwargs)
|
17 |
thread.start()
|
18 |
|
@@ -32,8 +32,8 @@ iface = gr.Interface(
|
|
32 |
title="Qwen2.5-Coder-1.5B Code Generator",
|
33 |
description="Enter a prompt to generate Python code using Qwen2.5-Coder-1.5B",
|
34 |
examples=[
|
35 |
-
["Write a Python function to calculate the factorial of a number."],
|
36 |
-
["Create a class representing a simple bank account with deposit and withdraw methods."]
|
37 |
]
|
38 |
)
|
39 |
|
|
|
12 |
inputs = tokenizer(prompt, return_tensors="pt")
|
13 |
streamer = TextIteratorStreamer(tokenizer)
|
14 |
|
15 |
+
generation_kwargs = dict(inputs, streamer=streamer, max_new_tokens=int(max_length))
|
16 |
thread = Thread(target=model.generate, kwargs=generation_kwargs)
|
17 |
thread.start()
|
18 |
|
|
|
32 |
title="Qwen2.5-Coder-1.5B Code Generator",
|
33 |
description="Enter a prompt to generate Python code using Qwen2.5-Coder-1.5B",
|
34 |
examples=[
|
35 |
+
["Write a Python function to calculate the factorial of a number.", 200],
|
36 |
+
["Create a class representing a simple bank account with deposit and withdraw methods.", 300]
|
37 |
]
|
38 |
)
|
39 |
|