Ashhar commited on
Commit
e7b6c01
·
1 Parent(s): 4ae6860
Files changed (1) hide show
  1. app.py +14 -13
app.py CHANGED
@@ -46,11 +46,11 @@ def __nowInIST():
46
  return DT.datetime.now(pytz.timezone("Asia/Kolkata"))
47
 
48
 
49
- # def __attachIp(request: gr.Request):
50
- # global ipAddress
51
- # x_forwarded_for = request.headers.get('x-forwarded-for')
52
- # if x_forwarded_for:
53
- # ipAddress = x_forwarded_for
54
 
55
 
56
  def pprint(log: str):
@@ -104,6 +104,7 @@ css = """
104
  """
105
 
106
  with gr.Blocks(css=css, title="Create interesting sentences on the fly ✈") as demo:
 
107
  gr.Markdown("# Create interesting sentences on the fly ✈")
108
  gr.Markdown("Powered by Groq & Llama 3.1")
109
 
@@ -119,14 +120,14 @@ with gr.Blocks(css=css, title="Create interesting sentences on the fly ✈") as
119
 
120
  copy_button = gr.Button("Use Output", variant="primary")
121
 
122
- # input_box.change(
123
- # fn=autocomplete,
124
- # inputs=input_box,
125
- # outputs=output_box,
126
- # show_progress="hidden",
127
- # api_name=None,
128
- # queue=True,
129
- # )
130
 
131
  copy_button.click(
132
  fn=lambda x: x,
 
46
  return DT.datetime.now(pytz.timezone("Asia/Kolkata"))
47
 
48
 
49
+ def __attachIp(request: gr.Request):
50
+ global ipAddress
51
+ x_forwarded_for = request.headers.get('x-forwarded-for')
52
+ if x_forwarded_for:
53
+ ipAddress = x_forwarded_for
54
 
55
 
56
  def pprint(log: str):
 
104
  """
105
 
106
  with gr.Blocks(css=css, title="Create interesting sentences on the fly ✈") as demo:
107
+ demo.load(__attachIp, None, None)
108
  gr.Markdown("# Create interesting sentences on the fly ✈")
109
  gr.Markdown("Powered by Groq & Llama 3.1")
110
 
 
120
 
121
  copy_button = gr.Button("Use Output", variant="primary")
122
 
123
+ input_box.change(
124
+ fn=autocomplete,
125
+ inputs=input_box,
126
+ outputs=output_box,
127
+ show_progress="minimal",
128
+ api_name=None,
129
+ queue=True,
130
+ )
131
 
132
  copy_button.click(
133
  fn=lambda x: x,