daneigh commited on
Commit
8572f11
Β·
verified Β·
1 Parent(s): 81d3d01

Update to direct API call

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -1,6 +1,8 @@
1
  import gradio as gr
2
  import sys
3
  import os
 
 
4
 
5
  # Import your inference function directly
6
  from test_mode import run_inference
@@ -28,7 +30,7 @@ def classify_meme(image):
28
  except Exception as e:
29
  return f"Error: {str(e)}"
30
 
31
- # Simple Gradio interface
32
  iface = gr.Interface(
33
  fn=classify_meme,
34
  inputs=gr.Image(type="pil"),
@@ -37,4 +39,5 @@ iface = gr.Interface(
37
  description="Meme content classifier"
38
  )
39
 
40
- iface.launch()
 
 
1
  import gradio as gr
2
  import sys
3
  import os
4
+ from flask import Flask, request, jsonify
5
+ import threading
6
 
7
  # Import your inference function directly
8
  from test_mode import run_inference
 
30
  except Exception as e:
31
  return f"Error: {str(e)}"
32
 
33
+ # Simple Gradio interface with API enabled
34
  iface = gr.Interface(
35
  fn=classify_meme,
36
  inputs=gr.Image(type="pil"),
 
39
  description="Meme content classifier"
40
  )
41
 
42
+ # Launch with API enabled
43
+ iface.launch(share=False)