Spaces:
Sleeping
Sleeping
ShivaPrakash
commited on
Commit
•
8d55312
1
Parent(s):
63dc61e
Delete app.py
Browse files
app.py
DELETED
@@ -1,164 +0,0 @@
|
|
1 |
-
import streamlit as st
|
2 |
-
import pandas as pd
|
3 |
-
import docx
|
4 |
-
import io
|
5 |
-
|
6 |
-
# Sample data
|
7 |
-
questions = [
|
8 |
-
{"no": 1, "question": "What is the capital of France?", "a": "Paris", "b": "London", "c": "Berlin", "d": "Madrid", "answer": "Paris"},
|
9 |
-
{"no": 2, "question": "What is the largest planet in our solar system?", "a": "Earth", "b": "Mars", "c": "Jupiter", "d": "Saturn", "answer": "Jupiter"},
|
10 |
-
# Add more questions as needed
|
11 |
-
]
|
12 |
-
|
13 |
-
text = """Explore pathways to get started with learning and working with Generative AI.Lesson Activities:Introduction (10 minutes):
|
14 |
-
Briefly discuss the history and evolution of AI.
|
15 |
-
Introduce the concept of Generative AI and its different types (e.g., text, image, audio).
|
16 |
-
Showcase examples of Generative AI applications in various industries.
|
17 |
-
Challenges and Opportunities (15 minutes):
|
18 |
-
Discuss the rapid pace of advancements in AI and the resulting confusion.
|
19 |
-
Address ethical concerns and potential biases in AI systems.
|
20 |
-
Explore the vast potential of Generative AI for innovation and problem-solving.
|
21 |
-
The Generative AI Engineer (20 minutes):
|
22 |
-
Define the role and responsibilities of a Generative AI engineer.
|
23 |
-
Explain the skillset required, including machine learning, software engineering, and problem-solving skills.
|
24 |
-
Discuss the importance of bridging the gap between research and practical applications.
|
25 |
-
Getting Started with Generative AI (25 minutes):
|
26 |
-
Provide resources and tools for learning about Generative AI.
|
27 |
-
Introduce popular platforms and frameworks for building AI models.
|
28 |
-
Share tips for building a portfolio and gaining practical experience.
|
29 |
-
Q&A and Discussion (30 minutes):
|
30 |
-
Answer questions from students and address their concerns.
|
31 |
-
Encourage discussion and sharing of ideas.
|
32 |
-
Motivate students to explore and experiment with Generative AI."""
|
33 |
-
|
34 |
-
# Initialize score
|
35 |
-
score = 0
|
36 |
-
answer = ['','','','','','','','','','']
|
37 |
-
i = 0
|
38 |
-
|
39 |
-
|
40 |
-
st.set_page_config(page_title="Dhrona.ai", page_icon="🏹")
|
41 |
-
st.title("🏹 Dhrona.ai 🏹 ")
|
42 |
-
# st.subheader('Your personalized teaching assistant by AI Anamolies')
|
43 |
-
|
44 |
-
default_title = "This is where title of your for the uploaded lecture gets published"
|
45 |
-
default_lessonplan = "This is where the default lesson plan gets uploaded"
|
46 |
-
default_notes = "This is where the notes get published"
|
47 |
-
|
48 |
-
ss = st.session_state
|
49 |
-
|
50 |
-
|
51 |
-
with st.sidebar:
|
52 |
-
with st.form("config"):
|
53 |
-
st.header("Upload here")
|
54 |
-
yturl = st.text_input('Enter YouTube URL ')
|
55 |
-
st.subheader("or")
|
56 |
-
audiofile = st.file_uploader("Please choose a file")
|
57 |
-
st.subheader("or")
|
58 |
-
driveurl = st.text_input('Enter location of the file')
|
59 |
-
if st.form_submit_button("submit"):
|
60 |
-
|
61 |
-
if 'youtube.com' in yturl:
|
62 |
-
# transcript = extract_youtube_transcript(url)
|
63 |
-
st.write('Text Summary:')
|
64 |
-
# st.write(transcript)
|
65 |
-
elif audiofile:
|
66 |
-
# transcript = extract_pdf_text(url)
|
67 |
-
st.write('Text Summary:')
|
68 |
-
# st.write(transcript)
|
69 |
-
elif driveurl:
|
70 |
-
# transcript = extract_pdf_text(url)
|
71 |
-
st.write('Text Summary:')
|
72 |
-
# st.write(transcript)
|
73 |
-
else:
|
74 |
-
st.write('Please enter a valid YouTube URL or file URL.')
|
75 |
-
|
76 |
-
st.info("""
|
77 |
-
[Dhrona.ai](https://github.com/xleven/ai-hackathon-judge) is a personalized teaching assistant
|
78 |
-
built by AI anomalies : [Siddartha](https://github.com/xleven) & [Shiva](https://github.com/langchain-ai/langchain) with [Streamlit](https://streamlit.io).
|
79 |
-
""", icon="ℹ️")
|
80 |
-
|
81 |
-
st.info("""
|
82 |
-
All you need to do is upload an Youtube url or audio file of your lecture. "Dhron" will give you a detailed, yet crisp notes along with a lesson plan. Once you are done going through the notes, you can test your skills by answering 10 MCQ's
|
83 |
-
""", icon="ℹ️")
|
84 |
-
|
85 |
-
st.header("Lesson Info")
|
86 |
-
title = st.write(default_title)
|
87 |
-
|
88 |
-
with st.expander("Lesson Plan"):
|
89 |
-
st.write(f"{default_lessonplan}")
|
90 |
-
|
91 |
-
with st.expander("Notes"):
|
92 |
-
st.write(f"{default_notes}")
|
93 |
-
|
94 |
-
# lessonplan = st.text_area("Lesson Plan", default_lessonplan, height=200)
|
95 |
-
# notes = st.text_area("Notes", default_notes, height=600)
|
96 |
-
|
97 |
-
st.divider()
|
98 |
-
|
99 |
-
#update your file here
|
100 |
-
file1 = "Notes.txt"
|
101 |
-
|
102 |
-
|
103 |
-
# def fileopen(filename):
|
104 |
-
# f = open('MCQ.docx', 'rb')
|
105 |
-
# Load the document
|
106 |
-
# doc_download = text
|
107 |
-
# Close the file
|
108 |
-
# f.close()
|
109 |
-
# Create a BytesIO object to hold the document data
|
110 |
-
# bio = io.BytesIO()
|
111 |
-
# Save the document to the BytesIO object
|
112 |
-
# doc_download.save(bio)
|
113 |
-
# return bio
|
114 |
-
|
115 |
-
|
116 |
-
# Reset the BytesIO object's position to the beginning
|
117 |
-
|
118 |
-
st.subheader("Download your notes here")
|
119 |
-
st.download_button(
|
120 |
-
label="Download Worldfile",
|
121 |
-
data=text.encode('utf-8'),
|
122 |
-
file_name=file1,
|
123 |
-
mime="text/plain",
|
124 |
-
# file_name="example.md",
|
125 |
-
# mime="text/markdown",
|
126 |
-
|
127 |
-
)
|
128 |
-
|
129 |
-
st.divider()
|
130 |
-
|
131 |
-
st.header("Assessment")
|
132 |
-
with st.expander("Lets take the test when ready!!"):
|
133 |
-
# st.write(f"{default_lessonplan}")
|
134 |
-
|
135 |
-
|
136 |
-
# Create a form for the quiz
|
137 |
-
with st.form(key='quiz_form'):
|
138 |
-
for question in questions:
|
139 |
-
st.subheader(f"Question {question['no']}: {question['question']}")
|
140 |
-
options = [question['a'], question['b'], question['c'], question['d']]
|
141 |
-
user_answer = st.radio("Select an answer", options, key=f"question_{question['no']}")
|
142 |
-
# st.write(user_answer)
|
143 |
-
answer[i] = user_answer
|
144 |
-
i +=1
|
145 |
-
print(answer)
|
146 |
-
# Submit button to calculate the score
|
147 |
-
|
148 |
-
if st.form_submit_button("Submit"):
|
149 |
-
i = 0
|
150 |
-
# "entering submit function"
|
151 |
-
# st.write(answer)
|
152 |
-
# st.write(questions)
|
153 |
-
for question in questions:
|
154 |
-
# st.write("Entering for loop")
|
155 |
-
# user_answer = st.radio(key=f"question_{question['no']}")
|
156 |
-
if question['answer'] == answer[i]:
|
157 |
-
# st.write("correct")
|
158 |
-
score += 1
|
159 |
-
else:
|
160 |
-
pass
|
161 |
-
# return score
|
162 |
-
i = i+1
|
163 |
-
# Display the final score outside the form
|
164 |
-
st.header(f"Your score: {score}/{len(questions)}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|