Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,14 +1,21 @@
|
|
1 |
from text_generator import TextGenerationTool
|
2 |
|
3 |
-
# Create an instance of the tool
|
4 |
-
text_gen_tool = TextGenerationTool(default_model="
|
5 |
|
6 |
# Launch the Gradio interface
|
7 |
if __name__ == "__main__":
|
8 |
import gradio as gr
|
9 |
|
10 |
with gr.Blocks(title="Text Generation Tool") as demo:
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
with gr.Row():
|
14 |
with gr.Column():
|
@@ -48,9 +55,9 @@ if __name__ == "__main__":
|
|
48 |
|
49 |
gr.Examples(
|
50 |
examples=[
|
51 |
-
["Write a short story about a robot learning to paint.", "
|
52 |
-
["Explain quantum computing to a 10-year-old.", "gpt2"],
|
53 |
-
["Write a poem about the changing seasons.", "
|
54 |
],
|
55 |
inputs=[prompt_input, model_dropdown]
|
56 |
)
|
|
|
1 |
from text_generator import TextGenerationTool
|
2 |
|
3 |
+
# Create an instance of the tool with a safer default model
|
4 |
+
text_gen_tool = TextGenerationTool(default_model="distilgpt2")
|
5 |
|
6 |
# Launch the Gradio interface
|
7 |
if __name__ == "__main__":
|
8 |
import gradio as gr
|
9 |
|
10 |
with gr.Blocks(title="Text Generation Tool") as demo:
|
11 |
+
# Add a warning about authentication
|
12 |
+
gr.Markdown("""
|
13 |
+
# Text Generation Tool
|
14 |
+
|
15 |
+
> **Note:** This application can run without a Hugging Face token, but some models may require authentication.
|
16 |
+
> For best results with larger models, set the `HF_TOKEN` environment variable with your token.
|
17 |
+
""")
|
18 |
+
|
19 |
|
20 |
with gr.Row():
|
21 |
with gr.Column():
|
|
|
55 |
|
56 |
gr.Examples(
|
57 |
examples=[
|
58 |
+
["Write a short story about a robot learning to paint.", "distilgpt2"],
|
59 |
+
["Explain quantum computing to a 10-year-old.", "gpt2-small"],
|
60 |
+
["Write a poem about the changing seasons.", "distilgpt2"]
|
61 |
],
|
62 |
inputs=[prompt_input, model_dropdown]
|
63 |
)
|