Spaces:
Sleeping
Sleeping
Gouzi Mohaled
commited on
Commit
·
21de675
1
Parent(s):
4abb184
lancement de app.py au lieu d'unicorn
Browse files- Dockerfile +5 -1
- app.py +8 -2
Dockerfile
CHANGED
@@ -12,4 +12,8 @@ COPY . .
|
|
12 |
RUN mkdir flagged
|
13 |
RUN chmod 777 flagged
|
14 |
|
15 |
-
|
|
|
|
|
|
|
|
|
|
12 |
RUN mkdir flagged
|
13 |
RUN chmod 777 flagged
|
14 |
|
15 |
+
# Exposer le port 7860 pour Gradio
|
16 |
+
EXPOSE 7860
|
17 |
+
|
18 |
+
# Lancer le script app.py qui contient le code de lancement de Gradio
|
19 |
+
CMD ["python", "app.py"]
|
app.py
CHANGED
@@ -70,5 +70,11 @@ async def predict(request: PromptRequest):
|
|
70 |
# Lancement de l'interface Gradio après le lancement de FastAPI
|
71 |
if __name__ == "__main__":
|
72 |
import uvicorn
|
73 |
-
|
74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
# Lancement de l'interface Gradio après le lancement de FastAPI
|
71 |
if __name__ == "__main__":
|
72 |
import uvicorn
|
73 |
+
import threading
|
74 |
+
|
75 |
+
# Lancer FastAPI dans un thread séparé
|
76 |
+
api_thread = threading.Thread(target=uvicorn.run, args=(app,), kwargs={"host": "0.0.0.0", "port": 8000})
|
77 |
+
api_thread.start()
|
78 |
+
|
79 |
+
# Lancer Gradio sur le port 7860
|
80 |
+
iface.launch(server_port=7860, share=True)
|