Spaces:
Sleeping
Sleeping
Create app.py
Browse files1234567891011121314151617181920212223242526272829303132import gradio as grfrom transformers import pipeline
# Load the Zephyr 7B Beta modelpipe = pipeline( "text-generation", model="HuggingFaceH4/zephyr-7b-beta", device_map="auto")
# API functiondef chat_api(prompt): # Generate a response from the model result = pipe( prompt, max_new_tokens=200, do_sample=True, temperature=0.7, top_p=0.9 ) return result[0]["generated_text"]
# Create Gradio Interface for API access (no UI needed)demo = gr.Interface( fn=chat_api, inputs=gr.Textbox(label="Prompt"), outputs=gr.Textbox(label="Response"), allow_flagging="never")
# Launch with API enableddemo.launch(server_name="0.0.0.0", server_port=7860)app.pyAdded+32