Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Commit
·
9a9722a
1
Parent(s):
e7ae6b8
feat - fixed libs and pydantic custom datatypes
Browse files- app.py +13 -1
- requirements.txt +1 -0
app.py
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import logging
|
| 2 |
import os
|
| 3 |
os.makedirs("tmp", exist_ok=True)
|
|
@@ -20,7 +32,7 @@ def handle_file_upload(file):
|
|
| 20 |
with open(file.name, "r") as f:
|
| 21 |
v = json.load(f)
|
| 22 |
return v, file_path
|
| 23 |
-
def submit_file(v, file_path, mn, profile
|
| 24 |
print('START SUBMITTING!!!')
|
| 25 |
if profile is None:
|
| 26 |
return "Hub Login Required"
|
|
|
|
| 1 |
+
from starlette.requests import Request
|
| 2 |
+
from pydantic_core import core_schema
|
| 3 |
+
|
| 4 |
+
def request_schema_handler(cls, source, handler):
|
| 5 |
+
# Return a valid string schema for Request objects.
|
| 6 |
+
return core_schema.str_schema()
|
| 7 |
+
|
| 8 |
+
Request.__get_pydantic_core_schema__ = classmethod(request_schema_handler)
|
| 9 |
+
|
| 10 |
+
# Continue with the rest of your imports…
|
| 11 |
+
import pydantic
|
| 12 |
+
|
| 13 |
import logging
|
| 14 |
import os
|
| 15 |
os.makedirs("tmp", exist_ok=True)
|
|
|
|
| 32 |
with open(file.name, "r") as f:
|
| 33 |
v = json.load(f)
|
| 34 |
return v, file_path
|
| 35 |
+
def submit_file(v, file_path, mn, profile):
|
| 36 |
print('START SUBMITTING!!!')
|
| 37 |
if profile is None:
|
| 38 |
return "Hub Login Required"
|
requirements.txt
CHANGED
|
@@ -21,3 +21,4 @@ openai
|
|
| 21 |
shortuuid
|
| 22 |
httpx==0.25.2
|
| 23 |
scikit-learn
|
|
|
|
|
|
| 21 |
shortuuid
|
| 22 |
httpx==0.25.2
|
| 23 |
scikit-learn
|
| 24 |
+
gradio[oauth]==4.20.0
|