sagar007 commited on
Commit
b834bb3
·
verified ·
1 Parent(s): 2848e2c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -11
app.py CHANGED
@@ -14,9 +14,9 @@ pipe = pipeline(
14
 
15
  # HTML content
16
  HTML_CONTENT = """
17
- <h1 style="text-align: center;">Llama-3.1-Storm-8B Text Generation</h1>
18
- <p style="text-align: center;">Generate text using the powerful Llama-3.1-Storm-8B model. Enter a prompt or select an example, and let the AI create!</p>
19
- <div style="display: flex; justify-content: center; margin-bottom: 20px;">
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
- "Write a short story about a magical llama.",
44
- "Explain the concept of machine learning to a 10-year-old.",
45
- "Describe the process of making the perfect cup of coffee.",
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()