Spaces:
Sleeping
Sleeping
Synced repo using 'sync_with_huggingface' Github Action
Browse files- __pycache__/gpt.cpython-310.pyc +0 -0
- app.py +13 -22
- venv/conda-meta/history +1 -1
__pycache__/gpt.cpython-310.pyc
CHANGED
|
Binary files a/__pycache__/gpt.cpython-310.pyc and b/__pycache__/gpt.cpython-310.pyc differ
|
|
|
app.py
CHANGED
|
@@ -1,27 +1,12 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import parsing
|
|
|
|
| 3 |
from custom_prompt import TexRestructureTemplate,MetadataTemplate
|
| 4 |
import ast
|
| 5 |
# from gpt import get_chat_completion
|
| 6 |
import openai
|
| 7 |
openAiKey = st.text_input(label="Input the openai key", type="password")
|
| 8 |
openai.api_key = openAiKey
|
| 9 |
-
# if openAiKey:
|
| 10 |
-
# try:
|
| 11 |
-
# openai.api_key = openAiKey
|
| 12 |
-
# # Test request to check if the key is valid
|
| 13 |
-
# openai.ChatCompletion.create(
|
| 14 |
-
# model="gpt-3.5-turbo",
|
| 15 |
-
# messages=[
|
| 16 |
-
# {"role": "system", "content": "You are a helpful assistant."},
|
| 17 |
-
# {"role": "user", "content": "Test prompt to check OpenAI key validity."}
|
| 18 |
-
# ]
|
| 19 |
-
# )
|
| 20 |
-
# st.success("OpenAI key is valid!")
|
| 21 |
-
# except Exception as e:
|
| 22 |
-
# st.write(f"Invalid OpenAI key: {e}")
|
| 23 |
-
# st.stop()
|
| 24 |
-
|
| 25 |
def get_chat_completion(prompt, model="gpt-3.5-turbo"):
|
| 26 |
try:
|
| 27 |
response = openai.ChatCompletion.create(
|
|
@@ -34,8 +19,6 @@ def get_chat_completion(prompt, model="gpt-3.5-turbo"):
|
|
| 34 |
return response['choices'][0]['message']['content']
|
| 35 |
except Exception as e:
|
| 36 |
return str(e)
|
| 37 |
-
|
| 38 |
-
|
| 39 |
def main():
|
| 40 |
st.sidebar.markdown("""
|
| 41 |
<style>
|
|
@@ -73,9 +56,9 @@ def main():
|
|
| 73 |
Contributors:
|
| 74 |
</div>
|
| 75 |
<ul>
|
| 76 |
-
<li class="list">MR LIKHIT NAYAK</li>
|
| 77 |
<li class="list">MR PRADIPTA PATTANAYAK</li>
|
| 78 |
-
<li class="list">
|
|
|
|
| 79 |
<li class="list">SK SHAHID</li>
|
| 80 |
</ul>
|
| 81 |
""", unsafe_allow_html=True)
|
|
@@ -138,11 +121,19 @@ def main():
|
|
| 138 |
"explanation": explanation,
|
| 139 |
"metadata": metadata
|
| 140 |
}
|
| 141 |
-
|
|
|
|
| 142 |
# Display the combined data as JSON
|
| 143 |
st.subheader("Link Result")
|
| 144 |
-
st.json(
|
| 145 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 146 |
except Exception as e:
|
| 147 |
st.error(f"Error: {e}")
|
| 148 |
else:
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import parsing
|
| 3 |
+
import json
|
| 4 |
from custom_prompt import TexRestructureTemplate,MetadataTemplate
|
| 5 |
import ast
|
| 6 |
# from gpt import get_chat_completion
|
| 7 |
import openai
|
| 8 |
openAiKey = st.text_input(label="Input the openai key", type="password")
|
| 9 |
openai.api_key = openAiKey
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
def get_chat_completion(prompt, model="gpt-3.5-turbo"):
|
| 11 |
try:
|
| 12 |
response = openai.ChatCompletion.create(
|
|
|
|
| 19 |
return response['choices'][0]['message']['content']
|
| 20 |
except Exception as e:
|
| 21 |
return str(e)
|
|
|
|
|
|
|
| 22 |
def main():
|
| 23 |
st.sidebar.markdown("""
|
| 24 |
<style>
|
|
|
|
| 56 |
Contributors:
|
| 57 |
</div>
|
| 58 |
<ul>
|
|
|
|
| 59 |
<li class="list">MR PRADIPTA PATTANAYAK</li>
|
| 60 |
+
<li class="list">MR LIKHIT NAYAK</li>
|
| 61 |
+
<li class="list">MR ASHUTOS SAHOO</li>
|
| 62 |
<li class="list">SK SHAHID</li>
|
| 63 |
</ul>
|
| 64 |
""", unsafe_allow_html=True)
|
|
|
|
| 121 |
"explanation": explanation,
|
| 122 |
"metadata": metadata
|
| 123 |
}
|
| 124 |
+
|
| 125 |
+
json_string = json.dumps(output_data, indent=2)
|
| 126 |
# Display the combined data as JSON
|
| 127 |
st.subheader("Link Result")
|
| 128 |
+
st.json(json_string)
|
| 129 |
|
| 130 |
+
st.download_button(
|
| 131 |
+
label="Download JSON",
|
| 132 |
+
data=json_string,
|
| 133 |
+
file_name="output_data.json",
|
| 134 |
+
mime="application/json"
|
| 135 |
+
)
|
| 136 |
+
|
| 137 |
except Exception as e:
|
| 138 |
st.error(f"Error: {e}")
|
| 139 |
else:
|
venv/conda-meta/history
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
-
==> 2023-12-18
|
| 2 |
# cmd: C:\Users\ashut\anaconda3\Scripts\conda-script.py create -p venv
|
| 3 |
# conda version: 22.9.0
|
|
|
|
| 1 |
+
==> 2023-12-18 22:29:38 <==
|
| 2 |
# cmd: C:\Users\ashut\anaconda3\Scripts\conda-script.py create -p venv
|
| 3 |
# conda version: 22.9.0
|