Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -14,9 +14,9 @@ pipe = pipeline(
|
|
| 14 |
|
| 15 |
# HTML content
|
| 16 |
HTML_CONTENT = """
|
| 17 |
-
<h1
|
| 18 |
-
<p
|
| 19 |
-
<div
|
| 20 |
<img src="https://cdn-uploads.huggingface.co/production/uploads/64c75c1237333ccfef30a602/tmOlbERGKP7JSODa6T06J.jpeg" alt="Llama" style="width:200px; border-radius:10px;">
|
| 21 |
</div>
|
| 22 |
"""
|
|
@@ -39,11 +39,11 @@ def generate_text(prompt, max_length, temperature):
|
|
| 39 |
|
| 40 |
return outputs[0]['generated_text'][len(formatted_prompt):]
|
| 41 |
|
|
|
|
| 42 |
examples = [
|
| 43 |
-
"
|
| 44 |
-
"Explain
|
| 45 |
-
"
|
| 46 |
-
"What are the main differences between Python and JavaScript?"
|
| 47 |
]
|
| 48 |
|
| 49 |
with gr.Blocks() as demo:
|
|
@@ -57,13 +57,13 @@ with gr.Blocks() as demo:
|
|
| 57 |
with gr.Column(scale=2):
|
| 58 |
output = gr.Textbox(label="Generated Text", lines=10)
|
| 59 |
|
|
|
|
|
|
|
|
|
|
| 60 |
gr.Examples(
|
| 61 |
examples=examples,
|
| 62 |
-
inputs=prompt,
|
| 63 |
-
label="Click on an example to load it into the prompt box:"
|
| 64 |
)
|
| 65 |
-
|
| 66 |
-
submit_button.click(generate_text, inputs=[prompt, max_length, temperature], outputs=[output])
|
| 67 |
|
| 68 |
if __name__ == "__main__":
|
| 69 |
demo.launch()
|
|
|
|
| 14 |
|
| 15 |
# HTML content
|
| 16 |
HTML_CONTENT = """
|
| 17 |
+
<h1>Llama-3.1-Storm-8B Text Generation</h1>
|
| 18 |
+
<p>Generate text using the powerful Llama-3.1-Storm-8B model. Enter a prompt and let the AI create!</p>
|
| 19 |
+
<div class="llama-image">
|
| 20 |
<img src="https://cdn-uploads.huggingface.co/production/uploads/64c75c1237333ccfef30a602/tmOlbERGKP7JSODa6T06J.jpeg" alt="Llama" style="width:200px; border-radius:10px;">
|
| 21 |
</div>
|
| 22 |
"""
|
|
|
|
| 39 |
|
| 40 |
return outputs[0]['generated_text'][len(formatted_prompt):]
|
| 41 |
|
| 42 |
+
# Define examples
|
| 43 |
examples = [
|
| 44 |
+
["Tell me a short story about a brave astronaut.", 150, 0.7],
|
| 45 |
+
["Explain quantum computing in simple terms.", 200, 0.5],
|
| 46 |
+
["Write a haiku about spring.", 50, 1.0],
|
|
|
|
| 47 |
]
|
| 48 |
|
| 49 |
with gr.Blocks() as demo:
|
|
|
|
| 57 |
with gr.Column(scale=2):
|
| 58 |
output = gr.Textbox(label="Generated Text", lines=10)
|
| 59 |
|
| 60 |
+
submit_button.click(generate_text, inputs=[prompt, max_length, temperature], outputs=[output])
|
| 61 |
+
|
| 62 |
+
# Add examples
|
| 63 |
gr.Examples(
|
| 64 |
examples=examples,
|
| 65 |
+
inputs=[prompt, max_length, temperature],
|
|
|
|
| 66 |
)
|
|
|
|
|
|
|
| 67 |
|
| 68 |
if __name__ == "__main__":
|
| 69 |
demo.launch()
|