harxsan commited on
Commit
cd46991
1 Parent(s): 12ffa67

Added Gradio app

Browse files
Files changed (1) hide show
  1. app.py +11 -4
app.py CHANGED
@@ -1,8 +1,15 @@
1
 
 
2
  import gradio as gr
3
 
4
- def greet(name):
5
- return f"Hello, {name}!"
6
 
7
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
8
- iface.launch()
 
 
 
 
 
 
 
 
1
 
2
+ from transformers import pipeline
3
  import gradio as gr
4
 
5
+ pipe = pipeline("text-generation", model="unsloth/Llama-3.2-1B-Instruct")
 
6
 
7
+ def generate_text(prompt):
8
+ response = pipe(prompt, max_length=100, num_return_sequences=1)
9
+ return response[0]['generated_text']
10
+
11
+ iface = gr.Interface(fn=generate_text, inputs="text", outputs="text",
12
+ title="Text Generation with LLaMA-3.2",
13
+ description="Enter a prompt to generate text using the LLaMA-3.2 model.")
14
+
15
+ iface.launch(share=True)