SPACERUNNER99 commited on
Commit
2f6410a
·
verified ·
1 Parent(s): ea41cec

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -150,7 +150,7 @@ def yt_download(url):
150
  return video_path, yt.title
151
 
152
  def insta_oneapi(url, api_key):
153
- shortcode = url.split("/")[-1]
154
  print(shortcode)
155
  url_one="https://api.one-api.ir/instagram/v1/post/?shortcode="+shortcode
156
  request_body = [{"shortcode": shortcode},]
@@ -396,11 +396,17 @@ def process_video(url, type):
396
  # Format the time as a string
397
  current_time = time.strftime("%H:%M:%S", t)
398
  print("Current Time =", current_time)
399
- return output_video_file
 
 
 
 
 
 
400
 
401
  #def download_file(file_path):
402
  # return gr.File.update(file_path)
403
 
404
- iface = gr.Interface(fn=process_video, inputs=["text" ,gr.Dropdown(["insta", "youtube"])], outputs="file")
405
 
406
  iface.launch(debug=True)
 
150
  return video_path, yt.title
151
 
152
  def insta_oneapi(url, api_key):
153
+ shortcode = url.split("/")[-2]
154
  print(shortcode)
155
  url_one="https://api.one-api.ir/instagram/v1/post/?shortcode="+shortcode
156
  request_body = [{"shortcode": shortcode},]
 
396
  # Format the time as a string
397
  current_time = time.strftime("%H:%M:%S", t)
398
  print("Current Time =", current_time)
399
+
400
+ # Generate the URL for the file
401
+ file_url = f"https://spacerunner99-sub-gen-public.hf.space/gradio_api/file/{output_video_file}"
402
+ return file_url
403
+
404
+ def print_link(file_url):
405
+ print(f"File available at: {file_url}")
406
 
407
  #def download_file(file_path):
408
  # return gr.File.update(file_path)
409
 
410
+ iface = gr.Interface(fn=process_video, inputs=["text" ,gr.Dropdown(["insta", "youtube"])], outputs=gr.outputs.Textbox(label="File URL"))
411
 
412
  iface.launch(debug=True)