Spaces:
Sleeping
Sleeping
File size: 663 Bytes
b397a75 822fabb b397a75 b13b4cc 822fabb b397a75 55b6c6c b397a75 55b6c6c 822fabb b397a75 55b6c6c b397a75 822fabb 55b6c6c 822fabb b397a75 55b6c6c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
import gradio as gr
from transformers import pipeline
model_name = "curiouscurrent/omnicode"
text_generator = pipeline("text-generation", model=model_name)
history = []
def generate_response(prompt):
history.append(prompt)
final_prompt = "\n".join(history)
# Generate response
response = text_generator(final_prompt, max_length=100)[0]['generated_text']
return response
interface = gr.Interface(
fn=generate_response,
inputs=gr.inputs.Textarea(lines=4, placeholder="Enter your Prompt"),
outputs="text",
title="Text Generation App",
description="Generate text based on the input prompt."
)
interface.launch()
|