Download app.py from arun86/EmpathAI: direct link, hf CLI and curl.
- Browser
- Download file 520 Bytes
-
https://huggingface.co/spaces/arun86/EmpathAI/resolve/main/app.py
- Command line
-
hf download hf://spaces/arun86/EmpathAI/app.py
-
curl -L -o app.py https://huggingface.co/spaces/arun86/EmpathAI/resolve/main/app.py
520 Bytes
| import gradio as gr | |
| from transformers import pipeline | |
| # Load your model | |
| generator = pipeline("text-generation", model="arun86/EmpathAI") | |
| # Define the function | |
| def generate_text(prompt): | |
| return generator(prompt, | |
| max_length=500, # Adjust according to your needs | |
| num_return_sequences=1, | |
| temperature=0.7, | |
| top_k=50, | |
| top_p=0.95)[0]["generated_text"] | |
| # Create the Gradio interface | |
| interface = gr.Interface(fn=generate_text, inputs="text", outputs="text") | |
| # Launch the interface | |
| interface.launch() | |