Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
Browse files
app.py
CHANGED
@@ -719,7 +719,7 @@ def create_zip_of_files(md_files, mp3_files, wav_files, input_question):
|
|
719 |
|
720 |
|
721 |
def perform_ai_lookup(q, vocal_summary=True, extended_refs=False,
|
722 |
-
titles_summary=True, full_audio=False, useArxiv=
|
723 |
"""Main routine that uses Anthropic (Claude) + Gradio ArXiv RAG pipeline."""
|
724 |
start = time.time()
|
725 |
ai_constitution = """
|
@@ -746,11 +746,13 @@ def perform_ai_lookup(q, vocal_summary=True, extended_refs=False,
|
|
746 |
play_and_download_audio(audio_file, st.session_state['audio_format'])
|
747 |
|
748 |
|
749 |
-
#useArxiv = st.checkbox("Search Arxiv for Research Answer", value=False)
|
750 |
if useArxiv:
|
|
|
751 |
# --- 2) Arxiv RAG
|
752 |
#st.write("Arxiv's AI this Evening is Mixtral 8x7B...")
|
753 |
st.write('Running Arxiv RAG with Claude inputs.')
|
|
|
|
|
754 |
client = Client("awacke1/Arxiv-Paper-Search-And-QA-RAG-Pattern")
|
755 |
refs = client.predict(
|
756 |
q,
|
@@ -1105,9 +1107,10 @@ def main():
|
|
1105 |
key_suffix="welcome"
|
1106 |
)
|
1107 |
|
1108 |
-
# βΆ 3) Main action tabs
|
1109 |
tab_main = st.radio("Action:", ["π€ Voice", "πΈ Media", "π ArXiv", "π Editor"],
|
1110 |
horizontal=True)
|
|
|
1111 |
|
1112 |
# βΆ 4) Show or hide custom component (optional example)
|
1113 |
mycomponent = components.declare_component("mycomponent", path="mycomponent")
|
@@ -1132,7 +1135,8 @@ def main():
|
|
1132 |
vocal_summary=True,
|
1133 |
extended_refs=False,
|
1134 |
titles_summary=True,
|
1135 |
-
full_audio=full_audio
|
|
|
1136 |
else:
|
1137 |
if st.button("βΆ Run"):
|
1138 |
st.session_state.old_val = val
|
@@ -1141,7 +1145,8 @@ def main():
|
|
1141 |
vocal_summary=True,
|
1142 |
extended_refs=False,
|
1143 |
titles_summary=True,
|
1144 |
-
full_audio=full_audio
|
|
|
1145 |
|
1146 |
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
1147 |
# TAB: ArXiv
|
|
|
719 |
|
720 |
|
721 |
def perform_ai_lookup(q, vocal_summary=True, extended_refs=False,
|
722 |
+
titles_summary=True, full_audio=False, useArxiv=True):
|
723 |
"""Main routine that uses Anthropic (Claude) + Gradio ArXiv RAG pipeline."""
|
724 |
start = time.time()
|
725 |
ai_constitution = """
|
|
|
746 |
play_and_download_audio(audio_file, st.session_state['audio_format'])
|
747 |
|
748 |
|
|
|
749 |
if useArxiv:
|
750 |
+
q = q + result # Feed Arxiv the question and Claude's answer for prompt fortification to get better answers and references
|
751 |
# --- 2) Arxiv RAG
|
752 |
#st.write("Arxiv's AI this Evening is Mixtral 8x7B...")
|
753 |
st.write('Running Arxiv RAG with Claude inputs.')
|
754 |
+
st.code(q, language="python", *, line_numbers=True, wrap_lines=True)
|
755 |
+
|
756 |
client = Client("awacke1/Arxiv-Paper-Search-And-QA-RAG-Pattern")
|
757 |
refs = client.predict(
|
758 |
q,
|
|
|
1107 |
key_suffix="welcome"
|
1108 |
)
|
1109 |
|
1110 |
+
# βΆ 3) Main action tabs and model use choices
|
1111 |
tab_main = st.radio("Action:", ["π€ Voice", "πΈ Media", "π ArXiv", "π Editor"],
|
1112 |
horizontal=True)
|
1113 |
+
useArxiv = st.checkbox("Search Arxiv for Research Answer", value=False)
|
1114 |
|
1115 |
# βΆ 4) Show or hide custom component (optional example)
|
1116 |
mycomponent = components.declare_component("mycomponent", path="mycomponent")
|
|
|
1135 |
vocal_summary=True,
|
1136 |
extended_refs=False,
|
1137 |
titles_summary=True,
|
1138 |
+
full_audio=full_audio,
|
1139 |
+
useArxiv)
|
1140 |
else:
|
1141 |
if st.button("βΆ Run"):
|
1142 |
st.session_state.old_val = val
|
|
|
1145 |
vocal_summary=True,
|
1146 |
extended_refs=False,
|
1147 |
titles_summary=True,
|
1148 |
+
full_audio=full_audio,
|
1149 |
+
useArxiv)
|
1150 |
|
1151 |
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
1152 |
# TAB: ArXiv
|