Benjamin Bossan commited on
Commit
f397951
1 Parent(s): 165ed63

Further debugging

Browse files
Files changed (2) hide show
  1. Dockerfile +10 -3
  2. demo.py +14 -7
Dockerfile CHANGED
@@ -1,6 +1,6 @@
1
  FROM pytorch/pytorch:latest
2
 
3
- RUN apt update && apt install -y && apt install ffmpeg && rm -rf /var/lib/apt/lists/*
4
 
5
  # Set up a new user named "user" with user ID 1000
6
  RUN useradd -m -u 1000 user
@@ -23,6 +23,13 @@ COPY --chown=user src ./src
23
  RUN python3 -m pip install .
24
 
25
  COPY --chown=user "demo.py" .
26
- EXPOSE 7860 8080
27
 
28
- CMD ["python3", "demo.py"]
 
 
 
 
 
 
 
 
 
1
  FROM pytorch/pytorch:latest
2
 
3
+ RUN apt update && apt install -y && apt install -y ffmpeg&& rm -rf /var/lib/apt/lists/*
4
 
5
  # Set up a new user named "user" with user ID 1000
6
  RUN useradd -m -u 1000 user
 
23
  RUN python3 -m pip install .
24
 
25
  COPY --chown=user "demo.py" .
 
26
 
27
+ # EXPOSE 7860 8080
28
+
29
+ # COPY --chown=user "start.sh" .
30
+ # RUN chmod +x "start.sh"
31
+
32
+ # CMD ["./start.sh"]
33
+
34
+ EXPOSE 7860
35
+ CMD ["python3", "./demo.py"]
demo.py CHANGED
@@ -4,11 +4,14 @@ import gradio as gr
4
 
5
  client = httpx.Client()
6
  # TODO: update the tags somehow; re-fetching inside of check_status doesn't work
7
- tag_counts = {
8
- key.strip("#"): val
9
- for key, val in client.get("http://localhost:8080/tag_counts/").json().items()
10
- if key.strip("#")
11
- }
 
 
 
12
 
13
 
14
  def submit(inputs):
@@ -19,8 +22,12 @@ def submit(inputs):
19
 
20
 
21
  def check_status():
22
- response = httpx.get("http://localhost:8080/check_job_status/")
23
- return response.json()
 
 
 
 
24
 
25
 
26
  def get_results(inputs: list[str]):
 
4
 
5
  client = httpx.Client()
6
  # TODO: update the tags somehow; re-fetching inside of check_status doesn't work
7
+ try:
8
+ tag_counts = {
9
+ key.strip("#"): val
10
+ for key, val in client.get("http://localhost:8080/tag_counts/").json().items()
11
+ if key.strip("#")
12
+ }
13
+ except httpx.ConnectError:
14
+ tag_counts = {}
15
 
16
 
17
  def submit(inputs):
 
22
 
23
 
24
  def check_status():
25
+ try:
26
+ response = httpx.get("http://localhost:8080/check_job_status/")
27
+ result = response.json()
28
+ except httpx.ConnectError:
29
+ result = "Server could not be reached"
30
+ return result
31
 
32
 
33
  def get_results(inputs: list[str]):