muneebashraf commited on
Commit
b69f781
·
1 Parent(s): 3608146

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -0
app.py CHANGED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import gradio as gr
3
+
4
+ # Install replicate package
5
+ !pip install replicate
6
+
7
+ # Set the API token as an environment variable without the angle brackets
8
+ os.environ['REPLICATE_API_TOKEN'] = 'r8_AxVDJKL3PAFFamBzTOpV0PpMPgxX0tz0IDf12'
9
+
10
+ # Import replicate
11
+ import replicate
12
+
13
+ # Define the function that uses replicate
14
+ def run_replicate(prompt):
15
+ # Use replicate to run the model
16
+ output = replicate.run(
17
+ "stability-ai/sdxl:2b017d9b67edd2ee1401238df49d75da53c523f36e363881e057f5dc3ed3c5b2",
18
+ input={"prompt": prompt}
19
+ )
20
+ return output
21
+
22
+ # Create the Gradio interface
23
+ iface = gr.Interface(
24
+ fn=run_replicate,
25
+ inputs=gr.inputs.Textbox(placeholder="Enter your prompt..."),
26
+ outputs="text"
27
+ )
28
+
29
+ # Launch the Gradio interface
30
+ iface.launch()