File size: 1,444 Bytes
e7a1e10
e7b9dae
e7a1e10
 
415515a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e7a1e10
 
 
415515a
 
 
e7a1e10
 
94f9c4a
e7a1e10
 
 
 
 
4a95f54
e7a1e10
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import gradio as gr
import torch
from in2in.utils.plot import plot_3d_motion
from in2in.utils.paramUtil import HML_KINEMATIC_CHAIN
from transformers import AutoModel     

import random
import string

def generate_random_filename(length=10, extension='.mp4'):
    """
    Generates a random file name with the specified length and file extension.
    
    Args:
        length (int): The desired length of the file name (excluding the extension).
        extension (str): The file extension, including the dot (e.g., '.txt', '.jpg', '.pdf').
    
    Returns:
        str: The generated random file name with the specified extension.
    """
    characters = string.ascii_letters + string.digits
    filename = ''.join(random.choice(characters) for _ in range(length))
    return filename + extension

def generate(textI, texti1, texti2):
    preds = model(textI, texti1, texti2)
    filename = generate_random_filename(length=15, extension='.mp4')
    plot_3d_motion(filename, HML_KINEMATIC_CHAIN, preds, title="", fps=30)
    return filename

model = AutoModel.from_pretrained("pabloruizponce/in2IN", trust_remote_code=True)
model.to("cuda")
demo = gr.Interface(fn=generate, 
                    inputs=[gr.Text(label="Interaction Description"),
                            gr.Text(label="Individual1 Description"),
                            gr.Text(label="Individual2 Description")],
                    outputs=gr.Video())

demo.launch()