Techperceptech commited on
Commit
eaa8a1d
·
verified ·
1 Parent(s): 5681111

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +46 -46
app.py CHANGED
@@ -88,56 +88,56 @@ def process_quotes(quotes_file_path, quotes_col_name, tags_string):
88
  quotes_df['Tags'] = quotes_data.apply(tag_quote, args=(tags_list,))
89
  return quotes_df[[quotes_col_name, 'Tags']]
90
 
91
- def authenticate(username, password):
92
- """Authenticate the user using static username and password"""
93
- if username == VALID_USERNAME and password == VALID_PASSWORD:
94
- return True
95
- else:
96
- return False
97
 
98
- def auth_interface(username, password):
99
- """Handle the authentication and proceed with the main function if valid"""
100
- if authenticate(username, password):
101
- return gr.Interface(
102
- fn=process_quotes,
103
- inputs=[
104
- gr.File(label="Quotes Excel File"), # File as generated by TFT software
105
- gr.Textbox(label="Name of quotes column"), # use this to identify the col with the quotes
106
- gr.Textbox(label="List of tags separated by commas")
107
- ],
108
- outputs=gr.Dataframe(headers=["Quote", "Tags"], column_widths=["70%", "30%"], scale=2),
109
- title=title,
110
- description=description
111
- ).launch()
112
- else:
113
- return "Invalid username or password!"
114
-
115
- # Create the authentication fields before launching the main app
116
- auth_app = gr.Interface(
117
- fn=auth_interface,
118
- inputs=[
119
- gr.Textbox(label="Username", type="text"),
120
- gr.Textbox(label="Password", type="password")
121
- ],
122
- outputs="text",
123
- title="Login to Automated Research Code Tagger",
124
- description="Please enter the correct username and password to access the tool."
125
- )
126
-
127
- auth_app.launch()
128
- # demo = gr.Interface(
129
- # fn=process_quotes,
130
  # inputs=[
131
- # gr.File(label="Quotes Excel File"), # File as generated by TFT software
132
- # gr.Textbox(label="Name of quotes column"), # use this to identify the col with the quotes
133
- # gr.Textbox(label = "List of tags separated by commas")
134
  # ],
135
- # outputs=gr.Dataframe(headers=["Quote", "Tags"], column_widths=["70%", "30%"], scale=2),
136
- # title=title,
137
- # description=description
138
- # )
 
 
 
 
 
 
 
 
 
 
 
 
 
139
 
140
- # demo.launch()
141
 
142
  # For later when I enable usage of own API key
143
  # api_key = gr.Textbox(
 
88
  quotes_df['Tags'] = quotes_data.apply(tag_quote, args=(tags_list,))
89
  return quotes_df[[quotes_col_name, 'Tags']]
90
 
91
+ # def authenticate(username, password):
92
+ # """Authenticate the user using static username and password"""
93
+ # if username == VALID_USERNAME and password == VALID_PASSWORD:
94
+ # return True
95
+ # else:
96
+ # return False
97
 
98
+ # def auth_interface(username, password):
99
+ # """Handle the authentication and proceed with the main function if valid"""
100
+ # if authenticate(username, password):
101
+ # return gr.Interface(
102
+ # fn=process_quotes,
103
+ # inputs=[
104
+ # gr.File(label="Quotes Excel File"), # File as generated by TFT software
105
+ # gr.Textbox(label="Name of quotes column"), # use this to identify the col with the quotes
106
+ # gr.Textbox(label="List of tags separated by commas")
107
+ # ],
108
+ # outputs=gr.Dataframe(headers=["Quote", "Tags"], column_widths=["70%", "30%"], scale=2),
109
+ # title=title,
110
+ # description=description
111
+ # ).launch()
112
+ # else:
113
+ # return "Invalid username or password!"
114
+
115
+ # # Create the authentication fields before launching the main app
116
+ # auth_app = gr.Interface(
117
+ # fn=auth_interface,
 
 
 
 
 
 
 
 
 
 
 
 
118
  # inputs=[
119
+ # gr.Textbox(label="Username", type="text"),
120
+ # gr.Textbox(label="Password", type="password")
 
121
  # ],
122
+ # outputs="text",
123
+ # title="Login to Automated Research Code Tagger",
124
+ # description="Please enter the correct username and password to access the tool."
125
+ # )
126
+
127
+ # auth_app.launch()
128
+ demo = gr.Interface(
129
+ fn=process_quotes,
130
+ inputs=[
131
+ gr.File(label="Quotes Excel File"), # File as generated by TFT software
132
+ gr.Textbox(label="Name of quotes column"), # use this to identify the col with the quotes
133
+ gr.Textbox(label = "List of tags separated by commas")
134
+ ],
135
+ outputs=gr.Dataframe(headers=["Quote", "Tags"], column_widths=["70%", "30%"], scale=2),
136
+ title=title,
137
+ description=description
138
+ )
139
 
140
+ demo.launch()
141
 
142
  # For later when I enable usage of own API key
143
  # api_key = gr.Textbox(