Rishit commited on
Commit
f649886
Β·
verified Β·
1 Parent(s): 70f28c1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +70 -7
app.py CHANGED
@@ -11,19 +11,82 @@ def get_response(user_input):
11
 
12
  # Check if the request was successful
13
  if response.status_code == 200:
14
- # Extract the answer from the response
15
- answer = response.text # Assuming the API response is already a string
16
- return answer
17
  else:
18
- return "Sorry, there was an error with your request."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
 
20
  # Create the Gradio interface
21
  iface = gr.Interface(
22
  fn=get_response, # Function to call when user submits input
23
  inputs="text", # Input type
24
  outputs="text", # Output type
25
- title="Temple Dekho Chat Bot",
26
- description="🟒 You can now use, Backend Server is live!\n\n\nAsk a question about temples or rituals and get answers from the Guru!"
 
 
27
  )
28
 
29
- iface.launch(share=True)
 
 
11
 
12
  # Check if the request was successful
13
  if response.status_code == 200:
14
+ answer = response.text # API response is already a string
15
+ return "πŸ•‰οΈ Guruji says: πŸ™\n\n" + answer
 
16
  else:
17
+ return "πŸ™ Sorry, there was an error with your request."
18
+
19
+
20
+ # Custom CSS to make the interface more spiritual and aesthetic
21
+ custom_css = """
22
+ body {
23
+ background: linear-gradient(135deg, #ffefba, #ffffff);
24
+ font-family: 'Georgia', serif;
25
+ }
26
+
27
+ .gradio-container {
28
+ border: 2px solid #f1c40f;
29
+ border-radius: 15px;
30
+ padding: 20px;
31
+ background-color: rgba(255, 255, 255, 0.9);
32
+ box-shadow: 0px 4px 15px rgba(0, 0, 0, 0.1);
33
+ }
34
+
35
+ h1 {
36
+ font-family: 'Georgia', serif;
37
+ color: #d35400;
38
+ text-align: center;
39
+ font-size: 2.5em;
40
+ }
41
+
42
+ .gradio-input, .gradio-output {
43
+ font-family: 'Georgia', serif;
44
+ font-size: 1.1em;
45
+ color: #2c3e50;
46
+ }
47
+
48
+ input, textarea {
49
+ border-radius: 10px;
50
+ padding: 10px;
51
+ font-size: 1.1em;
52
+ border: 2px solid #e67e22;
53
+ width: 100%;
54
+ }
55
+
56
+ textarea {
57
+ height: 200px;
58
+ }
59
+
60
+ button {
61
+ background-color: #e67e22;
62
+ border-radius: 10px;
63
+ font-size: 1.2em;
64
+ padding: 10px;
65
+ color: white;
66
+ width: 100%;
67
+ }
68
+
69
+ button:hover {
70
+ background-color: #d35400;
71
+ }
72
+
73
+ footer {
74
+ color: #7f8c8d;
75
+ text-align: center;
76
+ margin-top: 20px;
77
+ }
78
+ """
79
 
80
  # Create the Gradio interface
81
  iface = gr.Interface(
82
  fn=get_response, # Function to call when user submits input
83
  inputs="text", # Input type
84
  outputs="text", # Output type
85
+ title="πŸ•‰οΈ Temple Dekho Chat Bot πŸ•‰οΈ",
86
+ description="🟒 You can now use, Backend Server is live!\n\nπŸ™ Ask a question about temples or rituals and get wise answers from Guruji!",
87
+ theme="default", # Use the default theme
88
+ css=custom_css # Apply the custom CSS for styling
89
  )
90
 
91
+ # Launch the Gradio app with a specific server port
92
+ iface.launch(server_name="0.0.0.0", server_port=8709, share=True)