Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -376,91 +376,71 @@ def perform_ai_lookup(q, vocal_summary=True, extended_refs=False,
|
|
| 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 |
-
|
| 383 |
-
You are a talented songwriter with a unique ability to explain scientific concepts through music. Your task is to create a song that not only entertains but also educates listeners about a specific science problem and its potential solutions.
|
| 384 |
-
|
| 385 |
-
First, carefully read and analyze the science problem provided:
|
| 386 |
|
|
|
|
| 387 |
<science_problem>
|
| 388 |
{{SCIENCE_PROBLEM}}
|
| 389 |
</science_problem>
|
| 390 |
|
| 391 |
-
Next, consider the song style requested:
|
| 392 |
-
|
| 393 |
<song_style>
|
| 394 |
{{SONG_STYLE}}
|
| 395 |
</song_style>
|
| 396 |
|
| 397 |
-
Follow these steps to create your song:
|
| 398 |
|
| 399 |
1. Analyze the science problem:
|
| 400 |
- Identify the key issues and challenges
|
| 401 |
-
- Note any potential solutions or technologies mentioned
|
| 402 |
- Consider how these concepts can be simplified for a general audience
|
| 403 |
|
| 404 |
-
2. Plan your song structure
|
| 405 |
- Decide on a verse-chorus format that fits the song style
|
| 406 |
- Plan to introduce the problem in the verses
|
| 407 |
- Use the chorus to highlight key points or solutions
|
| 408 |
|
| 409 |
-
3. Write your lyrics
|
| 410 |
- Begin with an attention-grabbing opening line
|
| 411 |
- Use metaphors and analogies to explain complex concepts
|
| 412 |
- Ensure the lyrics flow naturally and fit the rhythm of the chosen song style
|
| 413 |
- Include scientific terminology, but explain it in simple terms within the song
|
| 414 |
|
| 415 |
-
4. Incorporate scientific explanations
|
| 416 |
- Weave factual information throughout the verses
|
| 417 |
- Use the chorus to reinforce main ideas or solutions
|
| 418 |
- Ensure that the scientific content is accurate and up-to-date
|
| 419 |
|
| 420 |
-
5. Match the requested song style
|
| 421 |
- Adapt your word choice and phrasing to fit the genre
|
| 422 |
- Consider the typical rhythm and structure of songs in this style
|
| 423 |
- If applicable, include style-specific elements (e.g., a rap break, a power ballad chorus)
|
| 424 |
|
| 425 |
-
6. Review and refine
|
| 426 |
- Check that the song effectively communicates the science problem and solutions
|
| 427 |
- Ensure the lyrics are catchy and memorable
|
| 428 |
- Verify that the song maintains the requested style throughout
|
| 429 |
-
|
| 430 |
-
Present your final song in the following format:
|
| 431 |
-
|
| 432 |
-
<song>
|
| 433 |
-
<title>[Insert creative title that reflects both the scientific concept and song style]</title>
|
| 434 |
-
|
| 435 |
-
<lyrics>
|
| 436 |
-
[Insert your full song lyrics here, clearly marking verses, chorus, and any other sections]
|
| 437 |
-
</lyrics>
|
| 438 |
-
|
| 439 |
-
<explanation>
|
| 440 |
-
[Provide a brief explanation of how the song addresses the science problem and its solutions, highlighting key scientific concepts included in the lyrics]
|
| 441 |
-
</explanation>
|
| 442 |
-
</song>
|
| 443 |
-
|
| 444 |
-
Remember to balance scientific accuracy with musical creativity, ensuring that your song is both informative and entertaining.
|
| 445 |
-
|
| 446 |
-
"""
|
| 447 |
-
|
| 448 |
-
|
| 449 |
-
|
| 450 |
|
| 451 |
client = Client("awacke1/Arxiv-Paper-Search-And-QA-RAG-Pattern")
|
| 452 |
-
refs = client.predict(
|
| 453 |
"mistralai/Mixtral-8x7B-Instruct-v0.1",
|
| 454 |
api_name="/update_with_rag_md")[0]
|
| 455 |
-
|
|
|
|
|
|
|
|
|
|
| 456 |
True, api_name="/ask_llm")
|
| 457 |
|
|
|
|
|
|
|
|
|
|
| 458 |
|
| 459 |
|
| 460 |
result = f"### 🔎 {q}\n\n{r2}\n\n{refs}"
|
| 461 |
st.markdown(result)
|
| 462 |
-
|
| 463 |
-
st.markdown(ai_constitution)
|
| 464 |
|
| 465 |
md_file, audio_file = save_qa_with_audio(q, result)
|
| 466 |
|
|
|
|
| 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 science problem provided:
|
| 383 |
<science_problem>
|
| 384 |
{{SCIENCE_PROBLEM}}
|
| 385 |
</science_problem>
|
| 386 |
|
| 387 |
+
2. Next, consider the song style requested:
|
|
|
|
| 388 |
<song_style>
|
| 389 |
{{SONG_STYLE}}
|
| 390 |
</song_style>
|
| 391 |
|
| 392 |
+
3. Follow these steps to create your song:
|
| 393 |
|
| 394 |
1. Analyze the science problem:
|
| 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 song structure. Document and enumerate in markdown outlines.:
|
| 400 |
- Decide on a verse-chorus format that fits the song style
|
| 401 |
- Plan to introduce the problem in the verses
|
| 402 |
- Use the chorus to highlight key points or solutions
|
| 403 |
|
| 404 |
+
3. Write your lyrics.:
|
| 405 |
- Begin with an attention-grabbing opening line
|
| 406 |
- Use metaphors and analogies to explain complex concepts
|
| 407 |
- Ensure the lyrics flow naturally and fit the rhythm of the chosen song style
|
| 408 |
- Include scientific terminology, but explain it in simple terms within the song
|
| 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 song style.:
|
| 416 |
- Adapt your word choice and phrasing to fit the genre
|
| 417 |
- Consider the typical rhythm and structure of songs in this style
|
| 418 |
- If applicable, include style-specific elements (e.g., a rap break, a power ballad chorus)
|
| 419 |
|
| 420 |
+
6. Review and refine, add useful paper titles, keywords, descriptions of topics and concepts.:
|
| 421 |
- Check that the song effectively communicates the science problem and solutions
|
| 422 |
- Ensure the lyrics are catchy and memorable
|
| 423 |
- Verify that the song maintains the requested style throughout
|
| 424 |
+
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 425 |
|
| 426 |
client = Client("awacke1/Arxiv-Paper-Search-And-QA-RAG-Pattern")
|
| 427 |
+
refs = client.predict(q, 20, "Semantic Search",
|
| 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 |
+
st.code(r2)
|
| 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 |
|