File size: 611 Bytes
b83b23c
0f200f0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b83b23c
 
0f200f0
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import gradio as gr
from transformers import pipeline

# Load your Hugging Face model (change the model name)
model_name = "abrotech/lora_model"
pipe = pipeline("text-generation", model=model_name)

# Define the function for Gradio
def generate_text(prompt):
    result = pipe(prompt, max_length=100)
    return result[0]["generated_text"]

# Create the Gradio Interface
demo = gr.Interface(
    fn=generate_text, 
    inputs="text", 
    outputs="text",
    title="Text Generation with Hugging Face",
    description="Enter a prompt, and the model will generate text."
)

# Launch the Gradio app
demo.launch()