Spaces:
Runtime error
Runtime error
Download app.py from Chuxia-sys/samp: direct link, hf CLI and curl.
- Browser
- Download file 575 Bytes
-
https://huggingface.co/spaces/Chuxia-sys/samp/resolve/main/app.py
- Command line
-
hf download hf://spaces/Chuxia-sys/samp/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Chuxia-sys/samp/resolve/main/app.py
575 Bytes
| import gradio as gr | |
| from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline | |
| MODEL_NAME = "Chuxia-sys/finetuned_model" | |
| tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME) | |
| model = AutoModelForCausalLM.from_pretrained(MODEL_NAME) | |
| pipe = pipeline("text-generation", model=model, tokenizer=tokenizer) | |
| def chat(user_input): | |
| result = pipe(user_input, max_new_tokens=200, temperature=0.7, do_sample=True) | |
| return result[0]["generated_text"] | |
| iface = gr.Interface(fn=chat, inputs="text", outputs="text", title="Finetuned Travel Planner AI") | |
| iface.launch() | |