Spaces:
Runtime error
Runtime error
soury commited on
Commit ·
7e77c34
1
Parent(s): adab244
adapt to hf requirements and upgrade versions (#4)
Browse files- Dockerfile +1 -1
- Pipfile.lock +0 -0
- README.md +1 -1
- main.py → app.py +8 -1
- assets/partials/head.html +1 -0
- requirements.txt +4 -0
- src/interface/interface.py +1 -5
Dockerfile
CHANGED
|
@@ -19,4 +19,4 @@ RUN pip install pipenv --user && \
|
|
| 19 |
|
| 20 |
EXPOSE ${ECOMINDAI_SERVER_PORT}
|
| 21 |
|
| 22 |
-
CMD ["./.venv/bin/python", "
|
|
|
|
| 19 |
|
| 20 |
EXPOSE ${ECOMINDAI_SERVER_PORT}
|
| 21 |
|
| 22 |
+
CMD ["./.venv/bin/python", "app.py"]
|
Pipfile.lock
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
README.md
CHANGED
|
@@ -53,7 +53,7 @@ docker run -p 8000:8000 sustain4raise/ecomindai:1.0.1
|
|
| 53 |
|
| 54 |
3. Run the application:
|
| 55 |
```bash
|
| 56 |
-
pipenv run python
|
| 57 |
```
|
| 58 |
|
| 59 |
The development server will start at `http://localhost:8000`
|
|
|
|
| 53 |
|
| 54 |
3. Run the application:
|
| 55 |
```bash
|
| 56 |
+
pipenv run python app.py
|
| 57 |
```
|
| 58 |
|
| 59 |
The development server will start at `http://localhost:8000`
|
main.py → app.py
RENAMED
|
@@ -1,15 +1,22 @@
|
|
| 1 |
import uvicorn
|
|
|
|
| 2 |
from fastapi import FastAPI
|
| 3 |
import gradio as gr
|
| 4 |
from src.interface.interface import io
|
| 5 |
from src.routers.resources import aiImpacts
|
| 6 |
import os
|
| 7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
print("Launching EcoMindAI v2 application")
|
| 9 |
|
| 10 |
app = FastAPI()
|
| 11 |
app.include_router(aiImpacts.router)
|
| 12 |
-
app = gr.mount_gradio_app(app, io, path="")
|
| 13 |
|
| 14 |
host = os.environ.get("ECOMINDAI_SERVER_HOST", "127.0.0.1")
|
| 15 |
port = int(os.environ.get("ECOMINDAI_SERVER_PORT", "8000"))
|
|
|
|
| 1 |
import uvicorn
|
| 2 |
+
from os import path
|
| 3 |
from fastapi import FastAPI
|
| 4 |
import gradio as gr
|
| 5 |
from src.interface.interface import io
|
| 6 |
from src.routers.resources import aiImpacts
|
| 7 |
import os
|
| 8 |
|
| 9 |
+
css_path = path.join(path.dirname(__file__), "./assets/styles/app.css")
|
| 10 |
+
with open(css_path, "r") as css_file:
|
| 11 |
+
custom_css = css_file.read()
|
| 12 |
+
head_path = path.join(path.dirname(__file__),
|
| 13 |
+
"./assets/partials/head.html")
|
| 14 |
+
|
| 15 |
print("Launching EcoMindAI v2 application")
|
| 16 |
|
| 17 |
app = FastAPI()
|
| 18 |
app.include_router(aiImpacts.router)
|
| 19 |
+
app = gr.mount_gradio_app(app, io, path="", css=custom_css, head_paths=head_path )
|
| 20 |
|
| 21 |
host = os.environ.get("ECOMINDAI_SERVER_HOST", "127.0.0.1")
|
| 22 |
port = int(os.environ.get("ECOMINDAI_SERVER_PORT", "8000"))
|
assets/partials/head.html
CHANGED
|
@@ -2,3 +2,4 @@
|
|
| 2 |
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
| 3 |
<link href="https://fonts.googleapis.com/css2?family=Lexend:wght@100..900&display=swap"
|
| 4 |
rel="stylesheet">
|
|
|
|
|
|
| 2 |
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
| 3 |
<link href="https://fonts.googleapis.com/css2?family=Lexend:wght@100..900&display=swap"
|
| 4 |
rel="stylesheet">
|
| 5 |
+
<link rel="stylesheet" href="/assets/styles/app.css">
|
requirements.txt
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gradio
|
| 2 |
+
referencing
|
| 3 |
+
jsonschema
|
| 4 |
+
requests
|
src/interface/interface.py
CHANGED
|
@@ -8,15 +8,11 @@ import pandas as pd
|
|
| 8 |
from src.services.serviceLLM.doc import load_doc
|
| 9 |
from src.interface.handlers import handle_launch
|
| 10 |
|
| 11 |
-
|
| 12 |
-
head_path = path.join(path.dirname(__file__),
|
| 13 |
-
"../../assets/partials/head.html")
|
| 14 |
-
css_path = path.join(path.dirname(__file__), "../../assets/styles/app.css")
|
| 15 |
csv_path = path.join(path.dirname(__file__), "../../assets/data/")
|
| 16 |
|
| 17 |
|
| 18 |
# Point d'entrée de l'application
|
| 19 |
-
with gr.Blocks(title="EcoMindAI",
|
| 20 |
analytics_enabled=False) as io:
|
| 21 |
title = gr.HTML("""<h1 class=\"logo\">EcoMindAI</h1>
|
| 22 |
<p>Estimating the environmental impact of an language model project </p>""")
|
|
|
|
| 8 |
from src.services.serviceLLM.doc import load_doc
|
| 9 |
from src.interface.handlers import handle_launch
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
csv_path = path.join(path.dirname(__file__), "../../assets/data/")
|
| 12 |
|
| 13 |
|
| 14 |
# Point d'entrée de l'application
|
| 15 |
+
with gr.Blocks(title="EcoMindAI",
|
| 16 |
analytics_enabled=False) as io:
|
| 17 |
title = gr.HTML("""<h1 class=\"logo\">EcoMindAI</h1>
|
| 18 |
<p>Estimating the environmental impact of an language model project </p>""")
|