Update app.py
Browse files
app.py
CHANGED
@@ -13,13 +13,28 @@ def generate_text(prompt):
|
|
13 |
outputs = model.generate(inputs["input_ids"], max_length=100, num_return_sequences=1)
|
14 |
return tokenizer.decode(outputs[0], skip_special_tokens=True)
|
15 |
|
16 |
-
|
17 |
-
interface = gr.Interface(
|
18 |
fn=generate_text,
|
19 |
-
inputs=
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
)
|
22 |
|
23 |
# Launch the Gradio app
|
24 |
-
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
outputs = model.generate(inputs["input_ids"], max_length=100, num_return_sequences=1)
|
14 |
return tokenizer.decode(outputs[0], skip_special_tokens=True)
|
15 |
|
16 |
+
iface = gr.Interface(
|
|
|
17 |
fn=generate_text,
|
18 |
+
inputs=[
|
19 |
+
gr.Textbox(label="Enter your prompt", placeholder="Start typing...", lines=5),
|
20 |
+
gr.Slider(minimum=50, maximum=200, value=100, step=1, label="Max Length"),
|
21 |
+
gr.Slider(minimum=0.1, maximum=1.0, value=0.7, step=0.1, label="Temperature"),
|
22 |
+
],
|
23 |
+
outputs="text",
|
24 |
+
title="OpenCoder 8B Instruct",
|
25 |
+
description="Generate text using the OpenCoder model. Adjust the settings and input a prompt to generate responses.",
|
26 |
)
|
27 |
|
28 |
# Launch the Gradio app
|
29 |
+
iface.launch(share=True)
|
30 |
+
|
31 |
+
# Create Gradio interface
|
32 |
+
# interface = gr.Interface(
|
33 |
+
# fn=generate_text,
|
34 |
+
# inputs=gr.Textbox(lines=2, placeholder="Enter your prompt here..."),
|
35 |
+
# outputs=gr.Textbox(label="Generated Text")
|
36 |
+
# )
|
37 |
+
|
38 |
+
# # Launch the Gradio app
|
39 |
+
# if __name__ == "__main__":
|
40 |
+
# interface.launch()
|