prithivMLmods commited on
Commit
aa7ca69
1 Parent(s): 3ed62a5

Create pythonproject.py

Browse files
Files changed (1) hide show
  1. pythonproject.py +19 -0
pythonproject.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastapi import FastAPI
2
+ from fastapi.middleware.cors import CORSMiddleware
3
+ import gradio as gr
4
+
5
+ def image_generator(prompt):
6
+ pass
7
+
8
+ interface = gr.Interface(fn=image_generator, inputs="text", outputs="image")
9
+ app = FastAPI()
10
+
11
+ app.add_middleware(
12
+ CORSMiddleware,
13
+ allow_origins=["*"],
14
+ allow_credentials=True,
15
+ allow_methods=["*"],
16
+ allow_headers=["*"],
17
+ )
18
+
19
+ app = gr.mount_gradio_app(app, interface, path="/")