Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -12,7 +12,6 @@ import json
|
|
12 |
import uuid # π² For generating unique IDs
|
13 |
from urllib.parse import quote # π For encoding URLs
|
14 |
from gradio_client import Client # π For connecting to Gradio apps
|
15 |
-
import openai # π€ For OpenAI API interactions
|
16 |
import markdown # π For parsing markdown content
|
17 |
from bs4 import BeautifulSoup # π² For parsing HTML content
|
18 |
|
@@ -26,11 +25,9 @@ CONTAINER_NAME = os.environ.get("COSMOS_CONTAINER_NAME")
|
|
26 |
Key = os.environ.get("Key") # π Don't forget your key!
|
27 |
|
28 |
# π Your local app URL (Change this to your app's URL)
|
29 |
-
LOCAL_APP_URL = "http://localhost:8501"
|
|
|
30 |
|
31 |
-
# π€ OpenAI configuration
|
32 |
-
openai.api_key = os.environ.get("OPENAI_API_KEY")
|
33 |
-
MODEL = "gpt-3.5-turbo" # Replace with your desired model
|
34 |
|
35 |
# π GitHub configuration
|
36 |
def download_github_repo(url, local_path):
|
@@ -224,21 +221,22 @@ def process_text(text_input, container):
|
|
224 |
st.markdown(text_input)
|
225 |
|
226 |
with st.chat_message("assistant"):
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
|
240 |
# Convert markdown to JSON structure
|
241 |
-
json_content = markdown_to_json(return_text)
|
|
|
242 |
|
243 |
# Create a record to insert into Cosmos DB
|
244 |
record = {
|
|
|
12 |
import uuid # π² For generating unique IDs
|
13 |
from urllib.parse import quote # π For encoding URLs
|
14 |
from gradio_client import Client # π For connecting to Gradio apps
|
|
|
15 |
import markdown # π For parsing markdown content
|
16 |
from bs4 import BeautifulSoup # π² For parsing HTML content
|
17 |
|
|
|
25 |
Key = os.environ.get("Key") # π Don't forget your key!
|
26 |
|
27 |
# π Your local app URL (Change this to your app's URL)
|
28 |
+
#LOCAL_APP_URL = "http://localhost:8501"
|
29 |
+
LOCAL_APP_URL = "https://huggingface.co/spaces/awacke1/AzureCosmosDBUI"
|
30 |
|
|
|
|
|
|
|
31 |
|
32 |
# π GitHub configuration
|
33 |
def download_github_repo(url, local_path):
|
|
|
221 |
st.markdown(text_input)
|
222 |
|
223 |
with st.chat_message("assistant"):
|
224 |
+
# completion = openai.ChatCompletion.create(
|
225 |
+
# model=MODEL,
|
226 |
+
# messages=[
|
227 |
+
# {"role": m["role"], "content": m["content"]}
|
228 |
+
# for m in st.session_state.messages
|
229 |
+
# ],
|
230 |
+
# stream=False
|
231 |
+
# )
|
232 |
+
# return_text = completion.choices[0].message.content
|
233 |
+
# st.write("Assistant: " + return_text)
|
234 |
+
# filename = create_and_save_file(return_text, file_type="md", prompt=text_input, is_image=False, should_save=True)
|
235 |
+
# st.session_state.messages.append({"role": "assistant", "content": return_text})
|
236 |
|
237 |
# Convert markdown to JSON structure
|
238 |
+
#json_content = markdown_to_json(return_text)
|
239 |
+
json_content = markdown_to_json(container)
|
240 |
|
241 |
# Create a record to insert into Cosmos DB
|
242 |
record = {
|