Spaces:
Build error
Build error
Download app.py from Bahareh0281/Medical-Text-Simplification: direct link, hf CLI and curl.
- Browser
- Download file 538 Bytes
-
https://huggingface.co/spaces/Bahareh0281/Medical-Text-Simplification/resolve/main/app.py
- Command line
-
hf download hf://spaces/Bahareh0281/Medical-Text-Simplification/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Bahareh0281/Medical-Text-Simplification/resolve/main/app.py
538 Bytes
| import gradio as gr | |
| from transformers import pipeline | |
| # Load a lightweight model | |
| chatbot = pipeline("text-generation", model="distilgpt2") | |
| # Define the chatbot function | |
| def chat(input_text): | |
| response = chatbot(input_text, max_length=100, do_sample=True) | |
| return response[0]["generated_text"] | |
| # Create the Gradio interface | |
| interface = gr.Interface( | |
| fn=chat, | |
| inputs="text", | |
| outputs="text", | |
| title="Chat with an LLM", | |
| description="Type your message and chat with the LLM!" | |
| ) | |
| # Launch the app | |
| interface.launch() | |