Added Gradio app
Browse files
app.py
CHANGED
@@ -1,8 +1,15 @@
|
|
1 |
|
|
|
2 |
import gradio as gr
|
3 |
|
4 |
-
|
5 |
-
return f"Hello, {name}!"
|
6 |
|
7 |
-
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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)
|