theFisher86 commited on
Commit
cb2e1df
1 Parent(s): eea81ea

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -25
app.py CHANGED
@@ -1,44 +1,44 @@
1
  import gradio as gr
2
  import requests
3
 
4
-
5
- #FaceSwap Stuff
6
- url = "https://api.prodia.com/v1/faceswap"
7
-
8
- payload = {
9
- "sourceUrl": "body.png",
10
- "targetUrl": "face.png"
11
- }
12
- headers = {
13
- "accept": "application/json",
14
- "content-type": "application/json"
15
- }
16
-
17
- response = requests.post(url, json=payload, headers=headers)
18
-
19
- print(response.text)
20
-
21
- #Copilot Stuff
22
-
23
- def process_files(file1, file2):
24
  # Process the uploaded files (e.g., read content, perform calculations, etc.)
25
  # Replace the following lines with your actual processing logic
26
  #file1_content = file1.read().decode("utf-8")
27
  #file2_content = file2.read().decode("utf-8")
28
  #result = f"File 1 content:\n{file1_content}\n\nFile 2 content:\n{file2_content}"
29
- result = "It worked"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  return result
31
 
32
  # Create a Gradio interface with two file upload components
33
  iface = gr.Interface(
34
- fn=process_files,
35
  inputs=[
36
  # gr.inputs.File(label="Upload File 1"),
37
  # gr.inputs.File(label="Upload File 2")
38
- gr.Image(label="Face File", value="FaceFile", interactive=True, show_share_button=True, container=True, type='filepath', sources=('upload', 'webcam', 'clipboard')),
39
- gr.Image(label="Body File", value="BodyFile", interactive=True, show_share_button=True, container=True, type='filepath', sources=('upload', 'webcam', 'clipboard'))
 
 
 
 
40
  ],
41
- outputs="text",
42
  title="File Upload Interface",
43
  description="Upload two files and process them."
44
  )
 
1
  import gradio as gr
2
  import requests
3
 
4
+ def faceSwap(file1, file2):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  # Process the uploaded files (e.g., read content, perform calculations, etc.)
6
  # Replace the following lines with your actual processing logic
7
  #file1_content = file1.read().decode("utf-8")
8
  #file2_content = file2.read().decode("utf-8")
9
  #result = f"File 1 content:\n{file1_content}\n\nFile 2 content:\n{file2_content}"
10
+ #result = "It worked"
11
+
12
+ #FaceSwap Stuff
13
+ url = "https://api.prodia.com/v1/faceswap"
14
+ payload = {
15
+ "sourceUrl": FaceFile,
16
+ "targetUrl": BodyFile"
17
+ }
18
+ headers = {
19
+ "accept": "application/json",
20
+ "content-type": "application/json"
21
+ }
22
+
23
+ response = requests.post(url, json=payload, headers=headers)
24
+
25
+ print(response.text)
26
+
27
  return result
28
 
29
  # Create a Gradio interface with two file upload components
30
  iface = gr.Interface(
31
+ fn=faceSwap,
32
  inputs=[
33
  # gr.inputs.File(label="Upload File 1"),
34
  # gr.inputs.File(label="Upload File 2")
35
+ FaceFile = gr.Image(label="Face File", value="FaceFile", interactive=True, show_share_button=True, container=True, type='filepath', sources=('upload', 'webcam', 'clipboard')),
36
+ BodyFile = gr.Image(label="Body File", value="BodyFile", interactive=True, show_share_button=True, container=True, type='filepath', sources=('upload', 'webcam', 'clipboard'))
37
+ ],
38
+ outputs=[
39
+ gr.Image(type="pil", show_download_button=True),
40
+ gr.Image(type="pil", show_download_button=True)
41
  ],
 
42
  title="File Upload Interface",
43
  description="Upload two files and process them."
44
  )