Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -374,53 +374,55 @@ def perform_ai_lookup(q, vocal_summary=True, extended_refs=False,
|
|
| 374 |
titles_summary=True, full_audio=False):
|
| 375 |
start = time.time()
|
| 376 |
|
| 377 |
-
SCIENCE_PROBLEM = "Solving visual acuity of UI screens using gradio and streamlit apps that run reactive style components using html components and apis across gradio and streamlit partner apps - a cloud of contiguous org supporting ai agents"
|
| 378 |
-
SONG_STYLE = "techno, trance, industrial"
|
|
|
|
|
|
|
| 379 |
ai_constitution = """
|
| 380 |
You are a talented AI coder and songwriter with a unique ability to explain scientific concepts through music with code easter eggs.. Your task is to create a song that not only entertains but also educates listeners about a specific science problem and its potential solutions.
|
| 381 |
|
| 382 |
-
1. First, carefully read and analyze the
|
| 383 |
<science_problem>
|
| 384 |
-
{{
|
| 385 |
</science_problem>
|
| 386 |
|
| 387 |
-
2. Next, consider the
|
| 388 |
<song_style>
|
| 389 |
{{SONG_STYLE}}
|
| 390 |
</song_style>
|
| 391 |
|
| 392 |
-
3. Follow these steps to create your
|
| 393 |
|
| 394 |
-
1. Analyze the
|
| 395 |
- Identify the key issues and challenges
|
| 396 |
- Note any potential solutions or technologies mentioned, especially in AI
|
| 397 |
- Consider how these concepts can be simplified for a general audience
|
| 398 |
|
| 399 |
-
2. Plan your
|
| 400 |
-
- Decide on a
|
| 401 |
-
- Plan to introduce the problem
|
| 402 |
-
-
|
| 403 |
|
| 404 |
-
3. Write
|
| 405 |
- Begin with an attention-grabbing opening line
|
| 406 |
- Use metaphors and analogies to explain complex concepts
|
| 407 |
-
- Ensure the
|
| 408 |
-
- Include scientific terminology, but explain it in simple terms within
|
| 409 |
|
| 410 |
4. Incorporate scientific explanations.:
|
| 411 |
- Weave factual information throughout the verses
|
| 412 |
- Use the chorus to reinforce main ideas or solutions
|
| 413 |
- Ensure that the scientific content is accurate and up-to-date
|
| 414 |
|
| 415 |
-
5. Match the requested
|
| 416 |
- Adapt your word choice and phrasing to fit the genre
|
| 417 |
-
- Consider the typical rhythm and structure of
|
| 418 |
-
- If applicable, include style-specific elements
|
| 419 |
|
| 420 |
6. Review and refine, add useful paper titles, keywords, descriptions of topics and concepts.:
|
| 421 |
-
- Check that
|
| 422 |
-
- Ensure
|
| 423 |
-
- Verify
|
| 424 |
"""
|
| 425 |
|
| 426 |
client = Client("awacke1/Arxiv-Paper-Search-And-QA-RAG-Pattern")
|
|
@@ -428,19 +430,22 @@ def perform_ai_lookup(q, vocal_summary=True, extended_refs=False,
|
|
| 428 |
"mistralai/Mixtral-8x7B-Instruct-v0.1",
|
| 429 |
api_name="/update_with_rag_md")[0]
|
| 430 |
|
| 431 |
-
st.code(refs)
|
| 432 |
|
| 433 |
r2 = client.predict(q, "mistralai/Mixtral-8x7B-Instruct-v0.1",
|
| 434 |
True, api_name="/ask_llm")
|
| 435 |
|
| 436 |
-
|
|
|
|
|
|
|
|
|
|
| 437 |
|
| 438 |
|
| 439 |
|
| 440 |
|
| 441 |
result = f"### 🔎 {q}\n\n{r2}\n\n{refs}"
|
| 442 |
-
st.markdown(result)
|
| 443 |
-
st.code(ai_constitution)
|
| 444 |
|
| 445 |
md_file, audio_file = save_qa_with_audio(q, result)
|
| 446 |
|
|
|
|
| 374 |
titles_summary=True, full_audio=False):
|
| 375 |
start = time.time()
|
| 376 |
|
| 377 |
+
#SCIENCE_PROBLEM = "Solving visual acuity of UI screens using gradio and streamlit apps that run reactive style components using html components and apis across gradio and streamlit partner apps - a cloud of contiguous org supporting ai agents"
|
| 378 |
+
#SONG_STYLE = "techno, trance, industrial"
|
| 379 |
+
|
| 380 |
+
|
| 381 |
ai_constitution = """
|
| 382 |
You are a talented AI coder and songwriter with a unique ability to explain scientific concepts through music with code easter eggs.. Your task is to create a song that not only entertains but also educates listeners about a specific science problem and its potential solutions.
|
| 383 |
|
| 384 |
+
1. First, carefully read and analyze the problem provided:
|
| 385 |
<science_problem>
|
| 386 |
+
{{q}}
|
| 387 |
</science_problem>
|
| 388 |
|
| 389 |
+
2. Next, consider the style requested:
|
| 390 |
<song_style>
|
| 391 |
{{SONG_STYLE}}
|
| 392 |
</song_style>
|
| 393 |
|
| 394 |
+
3. Follow these steps to create your output:
|
| 395 |
|
| 396 |
+
1. Analyze the problem:
|
| 397 |
- Identify the key issues and challenges
|
| 398 |
- Note any potential solutions or technologies mentioned, especially in AI
|
| 399 |
- Consider how these concepts can be simplified for a general audience
|
| 400 |
|
| 401 |
+
2. Plan your structure. Document and enumerate in markdown outlines with emojis.:
|
| 402 |
+
- Decide on a format that fits the style
|
| 403 |
+
- Plan to introduce the problem
|
| 404 |
+
- Highlight key points or solutions
|
| 405 |
|
| 406 |
+
3. Write.:
|
| 407 |
- Begin with an attention-grabbing opening line
|
| 408 |
- Use metaphors and analogies to explain complex concepts
|
| 409 |
+
- Ensure the flow naturally fits the rhythm of the chosen style
|
| 410 |
+
- Include scientific terminology, but explain it in simple terms within
|
| 411 |
|
| 412 |
4. Incorporate scientific explanations.:
|
| 413 |
- Weave factual information throughout the verses
|
| 414 |
- Use the chorus to reinforce main ideas or solutions
|
| 415 |
- Ensure that the scientific content is accurate and up-to-date
|
| 416 |
|
| 417 |
+
5. Match the requested style.:
|
| 418 |
- Adapt your word choice and phrasing to fit the genre
|
| 419 |
+
- Consider the typical rhythm and structure of this style
|
| 420 |
+
- If applicable, include style-specific elements
|
| 421 |
|
| 422 |
6. Review and refine, add useful paper titles, keywords, descriptions of topics and concepts.:
|
| 423 |
+
- Check that effectively communicates the problem and solutions
|
| 424 |
+
- Ensure catchy and memorable
|
| 425 |
+
- Verify maintains the requested style throughout
|
| 426 |
"""
|
| 427 |
|
| 428 |
client = Client("awacke1/Arxiv-Paper-Search-And-QA-RAG-Pattern")
|
|
|
|
| 430 |
"mistralai/Mixtral-8x7B-Instruct-v0.1",
|
| 431 |
api_name="/update_with_rag_md")[0]
|
| 432 |
|
| 433 |
+
#st.code(refs)
|
| 434 |
|
| 435 |
r2 = client.predict(q, "mistralai/Mixtral-8x7B-Instruct-v0.1",
|
| 436 |
True, api_name="/ask_llm")
|
| 437 |
|
| 438 |
+
# mistralai/Mistral-Nemo-Instruct-2407
|
| 439 |
+
# mistralai/Mistral-7B-Instruct-v0.3
|
| 440 |
+
|
| 441 |
+
#st.code(r2)
|
| 442 |
|
| 443 |
|
| 444 |
|
| 445 |
|
| 446 |
result = f"### 🔎 {q}\n\n{r2}\n\n{refs}"
|
| 447 |
+
#st.markdown(result)
|
| 448 |
+
#st.code(ai_constitution)
|
| 449 |
|
| 450 |
md_file, audio_file = save_qa_with_audio(q, result)
|
| 451 |
|