File size: 1,131 Bytes
0be2f6b
5a961f7
0be2f6b
5a961f7
 
0be2f6b
5a961f7
 
0be2f6b
5a961f7
 
 
 
 
 
 
0be2f6b
5a961f7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0be2f6b
5a961f7
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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()