Spaces:
Runtime error
Runtime error
Commit ·
e88d5a6
1
Parent(s): fe5044d
Deployment test
Browse files- Dockerfile +13 -0
- query.py +2 -2
Dockerfile
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.9
|
| 2 |
+
|
| 3 |
+
WORKDIR /code
|
| 4 |
+
|
| 5 |
+
COPY ./requirements.txt /code/requirements.txt
|
| 6 |
+
|
| 7 |
+
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
| 8 |
+
|
| 9 |
+
COPY . .
|
| 10 |
+
|
| 11 |
+
EXPOSE 7860
|
| 12 |
+
|
| 13 |
+
CMD ["shiny", "run", "app.py", "--host", "0.0.0.0", "--port", "7860"]
|
query.py
CHANGED
|
@@ -2,7 +2,7 @@ from plotnine import aes, geom_point, ggplot, labs, theme_light
|
|
| 2 |
from shiny import module, ui, reactive, render
|
| 3 |
import pandas as pd
|
| 4 |
import requests
|
| 5 |
-
|
| 6 |
|
| 7 |
|
| 8 |
@module.ui
|
|
@@ -71,7 +71,7 @@ def plot_response(df, plot_title):
|
|
| 71 |
|
| 72 |
def query(text):
|
| 73 |
API_URL = "https://api-inference.huggingface.co/models/j-hartmann/emotion-english-distilroberta-base"
|
| 74 |
-
headers = {"Authorization": "Bearer
|
| 75 |
payload = {"inputs": text}
|
| 76 |
response = requests.post(API_URL, headers=headers, json=payload)
|
| 77 |
return response.json()
|
|
|
|
| 2 |
from shiny import module, ui, reactive, render
|
| 3 |
import pandas as pd
|
| 4 |
import requests
|
| 5 |
+
import os
|
| 6 |
|
| 7 |
|
| 8 |
@module.ui
|
|
|
|
| 71 |
|
| 72 |
def query(text):
|
| 73 |
API_URL = "https://api-inference.huggingface.co/models/j-hartmann/emotion-english-distilroberta-base"
|
| 74 |
+
headers = {"Authorization": "Bearer " + os.environ["HF_API_KEY"]}
|
| 75 |
payload = {"inputs": text}
|
| 76 |
response = requests.post(API_URL, headers=headers, json=payload)
|
| 77 |
return response.json()
|