Spaces:
Runtime error
Runtime error
Gopala Krishna
commited on
Commit
•
53f63fb
1
Parent(s):
df4a407
Initial Commit
Browse files- .vs/ContactForm/FileContentIndex/157dde97-e009-4251-af91-30ca36b20a1e.vsidx +0 -0
- .vs/ContactForm/FileContentIndex/190fadaa-aa5f-462c-ad63-d5cfb2246449.vsidx +0 -0
- .vs/ContactForm/FileContentIndex/3a2ebcc8-19eb-4275-8777-a7b2ae90a0b3.vsidx +0 -0
- .vs/ContactForm/FileContentIndex/read.lock +0 -0
- .vs/ContactForm/v17/.wsuo +0 -0
- .vs/ProjectSettings.json +3 -0
- .vs/VSWorkspaceState.json +7 -0
- .vs/slnx.sqlite +0 -0
- app.py +32 -0
- requirements.txt +1 -0
.vs/ContactForm/FileContentIndex/157dde97-e009-4251-af91-30ca36b20a1e.vsidx
ADDED
Binary file (4.64 kB). View file
|
|
.vs/ContactForm/FileContentIndex/190fadaa-aa5f-462c-ad63-d5cfb2246449.vsidx
ADDED
Binary file (6.02 kB). View file
|
|
.vs/ContactForm/FileContentIndex/3a2ebcc8-19eb-4275-8777-a7b2ae90a0b3.vsidx
ADDED
Binary file (182 Bytes). View file
|
|
.vs/ContactForm/FileContentIndex/read.lock
ADDED
File without changes
|
.vs/ContactForm/v17/.wsuo
ADDED
Binary file (23.6 kB). View file
|
|
.vs/ProjectSettings.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"CurrentProjectSetting": null
|
3 |
+
}
|
.vs/VSWorkspaceState.json
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"ExpandedNodes": [
|
3 |
+
""
|
4 |
+
],
|
5 |
+
"SelectedNode": "\\C:\\AIMLApps\\HuggingSpace\\ContactForm",
|
6 |
+
"PreviewInSolutionExplorer": false
|
7 |
+
}
|
.vs/slnx.sqlite
ADDED
Binary file (90.1 kB). View file
|
|
app.py
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import pandas as pd
|
3 |
+
|
4 |
+
def save_to_excel(Name, Email, Comment):
|
5 |
+
data = {'Name': [Name], 'Email': [Email], 'Message': [Comment]}
|
6 |
+
df = pd.DataFrame(data)
|
7 |
+
|
8 |
+
# Read in existing sheet if it exists, or create an empty DataFrame
|
9 |
+
try:
|
10 |
+
existing_df = pd.read_excel('Contacts.xlsx', sheet_name='ContactDetails')
|
11 |
+
except:
|
12 |
+
existing_df = pd.DataFrame()
|
13 |
+
|
14 |
+
# Combine existing sheet with new data
|
15 |
+
combined_df = pd.concat([existing_df, df], ignore_index=True)
|
16 |
+
|
17 |
+
# Write combined data to new Excel file
|
18 |
+
writer = pd.ExcelWriter('Contacts.xlsx', engine='openpyxl', mode='w')
|
19 |
+
combined_df.to_excel(writer, sheet_name='ContactDetails', index=False)
|
20 |
+
writer.save()
|
21 |
+
return 'Thank you for contacting us!'
|
22 |
+
|
23 |
+
form = gr.Interface(fn=save_to_excel,
|
24 |
+
inputs=[gr.inputs.Textbox(label="Name"), gr.inputs.Textbox(label="Email"), gr.inputs.Textbox(lines=7, label="Comment")],
|
25 |
+
outputs=[],
|
26 |
+
title='Leave a Comment or Request Demo',
|
27 |
+
theme=gr.themes.Default(primary_hue="slate"))
|
28 |
+
form.launch()
|
29 |
+
|
30 |
+
|
31 |
+
|
32 |
+
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
pandas
|