Art / app.py
ordlibrary's picture
Update app.py
5a961f7 verified
import gradio as gr
import replicate
# Set your Replicate API token
REPLICATE_API_TOKEN = "r8_Fu3ISrxL0438RJSh7Ln1CEoXA5VZspl4M7nQn"
# Define the model
MODEL = "8bitsats/cheshireterminal"
# Function to interact with the model
def generate_response(prompt):
# Call the Replicate API
output = replicate.run(
MODEL,
input={"prompt": prompt},
api_token=REPLICATE_API_TOKEN
)
return output
# Gradio interface
def create_interface():
with gr.Blocks() as demo:
gr.Markdown("# Cheshire Terminal Model")
gr.Markdown("Enter your prompt below and let the model generate a response!")
with gr.Row():
input_text = gr.Textbox(label="Input Prompt", placeholder="Type your prompt here...")
output_text = gr.Textbox(label="Model Response", interactive=False)
submit_button = gr.Button("Generate Response")
submit_button.click(fn=generate_response, inputs=input_text, outputs=output_text)
return demo
# Launch the Gradio app
if __name__ == "__main__":
interface = create_interface()
interface.launch()