Update app.py
Browse files
app.py
CHANGED
@@ -20,18 +20,18 @@ def get_answers(question, context):
|
|
20 |
def main():
|
21 |
print("Hi! I am a simple AI chatbot built using Hugging Face.")
|
22 |
print("Type 'quit' to exit the program.")
|
23 |
-
query = ""
|
24 |
while True:
|
25 |
query = input("Your Question: ").strip()
|
26 |
if query.lower() == "quit":
|
27 |
break
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
|
|
35 |
|
36 |
if __name__ == "__main__":
|
37 |
main()
|
|
|
20 |
def main():
|
21 |
print("Hi! I am a simple AI chatbot built using Hugging Face.")
|
22 |
print("Type 'quit' to exit the program.")
|
|
|
23 |
while True:
|
24 |
query = input("Your Question: ").strip()
|
25 |
if query.lower() == "quit":
|
26 |
break
|
27 |
+
else:
|
28 |
+
if len(query) > 0:
|
29 |
+
context = "The capital of France is Paris."
|
30 |
+
try:
|
31 |
+
response = get_answers(query, context)
|
32 |
+
print(f"\nResponse: {response}\n")
|
33 |
+
except Exception as e:
|
34 |
+
print(f"\nError occurred: {str(e)}\n")
|
35 |
|
36 |
if __name__ == "__main__":
|
37 |
main()
|