Spaces:
Runtime error
Runtime error
File size: 662 Bytes
b3b72cf 7c2904b 74a0653 7c2904b 74a0653 e55a05c 7c2904b e55a05c 7c2904b e55a05c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
import os
import gradio as gr
from transformers import pipeline
def generate_text(prompt):
generator = pipeline('text-generation', model='tiiuae/falcon-40b-instruct', trust_remote_code=True)
return generator(prompt, max_length=100)[0]['generated_text']
def main():
interface = gr.Interface(
fn=generate_text,
inputs=gr.inputs.Textbox(lines=2, placeholder="Type your prompt here..."),
outputs="text",
title="Text Generation Model",
description="This model generates text based on the input prompt. Powered by Hugging Face transformers."
)
interface.launch()
if __name__ == "__main__":
main() |