pabloruizponce commited on
Commit
415515a
·
verified ·
1 Parent(s): 8267caa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -3
app.py CHANGED
@@ -2,12 +2,31 @@ import gradio as gr
2
  import torch
3
  from in2in.utils.plot import plot_3d_motion
4
  from in2in.utils.paramUtil import HML_KINEMATIC_CHAIN
5
- from transformers import AutoModel
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
 
7
  def generate(textI, texti1, texti2):
8
  preds = model(textI, texti1, texti2)
9
- plot_3d_motion("result.mp4", HML_KINEMATIC_CHAIN, preds, title="", fps=30)
10
- return "result.mp4"
 
11
 
12
  model = AutoModel.from_pretrained("pabloruizponce/in2IN", trust_remote_code=True)
13
  model.to("cuda")
 
2
  import torch
3
  from in2in.utils.plot import plot_3d_motion
4
  from in2in.utils.paramUtil import HML_KINEMATIC_CHAIN
5
+ from transformers import AutoModel
6
+
7
+ import random
8
+ import string
9
+
10
+ def generate_random_filename(length=10, extension='.mp4'):
11
+ """
12
+ Generates a random file name with the specified length and file extension.
13
+
14
+ Args:
15
+ length (int): The desired length of the file name (excluding the extension).
16
+ extension (str): The file extension, including the dot (e.g., '.txt', '.jpg', '.pdf').
17
+
18
+ Returns:
19
+ str: The generated random file name with the specified extension.
20
+ """
21
+ characters = string.ascii_letters + string.digits
22
+ filename = ''.join(random.choice(characters) for _ in range(length))
23
+ return filename + extension
24
 
25
  def generate(textI, texti1, texti2):
26
  preds = model(textI, texti1, texti2)
27
+ filename = generate_random_filename(length=15, extension='.mp4')
28
+ plot_3d_motion(filename, HML_KINEMATIC_CHAIN, preds, title="", fps=30)
29
+ return filename
30
 
31
  model = AutoModel.from_pretrained("pabloruizponce/in2IN", trust_remote_code=True)
32
  model.to("cuda")